# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Project Name: luffcity_study_code
File Name: 将90a1c中数据替换.py
Author: kij
Create Date: 2021/8/25
-------------------------------------------------
"""
import os
import re

from module_seven.fpjs import arrayjm

_0x4633 = ['MDEw', 'KDA2KQ==', '5p+l5peg5q2k56Wo', 'cnFlcnI=',
           '5b2T5pel5byA5YW35Y+R56Wo5Y+v5LqO5qyh5pel6L+b6KGM5p+l6aqM77yB', 'aW5yZWRpcw==', 'KDAyKQ==', 'd2ViZXJy',
           'KDAzKQ==', 'aW5vcmFjbGU=', 'KDA4KQ==', 'aW5kYXRh', 'KDA5KQ==', 'aW5jam9yYWNsZQ==', 'KDEwKQ==',
           '57O757uf5byC5bi477yM6K+36YeN6K+V77yB', 'MDEwXw==', '57O757uf5byC5bi477yM6K+36YeN6K+V77yBKDA1KQ==', 'MDE1',
           '57O757uf5byC5bi477yM6K+36YeN6K+V77yBKDAxNSk=', 'MDE2',
           '5pyN5Yqh5Zmo5o6l5pS255qE6K+35rGC5aSq6aKR57mB77yM6K+356iN5ZCO5YaN6K+V77yB',
           '57O757uf5byC5bi477yM6K+36YeN6K+V77yBKDA0KQ==', 'cGFyZW50', 'cHJpY29kZQ==', 'Y2xlYXJC', 'dGltZW91dA==',
           '57O757uf5byC5bi477yM6K+35rGC6LaF5pe277yB', 'I2NoZWNrZnA=', 'Y2xpY2s=', 'aGlkZQ==', 'I3VuY2hlY2tmcA==',
           'c2hvdw==', 'I2ZwZG0=', 'dmFs', 'dHJpbQ==', 'I2ZwaG0=', 'I2twcnE=', 'bGVuZ3Ro', 'dGVzdA==',
           '5pel5pyf5qC85byP6ZSZ6K+v77yM5Li6WVlZWU1NRETmoLzlvI/vvIE=', 'I2tqamU=', 'I3l6bQ==', 'aW5kZXhPZg==',
           'c3BsaXQ=', 'Y2hhckF0', 'L3ZhdFF1ZXJ5', 'bm55ZA==', 'L2ludlF1ZXJ5', '5Y+R56Wo5p+l6aqM6K+35rGC5aSx6LSlIQ==',
           'YWpheA==', 'cG9zdA==', 'anNvbnA=', 'Y2FsbGJhY2s=', 'aGFzT3duUHJvcGVydHk=', 'ZGF0YQ==', 'ZGVjb2Rl',
           'VVRGLTg=', 'a2V5MTI=', 'c3Vic3RyaW5n', 'a2V5Mg==', 'a2V5MQ==',
           '6K+l55yB5bCa5pyq5byA6YCa5Y+R56Wo5p+l6aqM5Yqf6IO977yB', 'MDAx', 'a2V5NQ==', 'a2V5Mw==', 'a2V5NA==',
           'dnNpZ24=', 'ZW5kZXRhaWw=', 'ZGVpbnY=', 'ZGVpbnZrZXk=', 'ZGVpbnZybQ==',
           '57O757uf5byC5bi477yM6K+36YeN6K+V77yBKDA3KQ==', '57O757uf6ZSZ6K+v', 'ZWRnZQ==', 'ZmlyZWZveA==',
           'Y3lqZ2VkZ2U=', 'Lmh0bWw=', '4omh4omh4omhSFdYWOKJoeKJoeKJoQ==', 'aWU4', 'YnJvd3Nlcg==', 'c3RyaW5naWZ5',
           'cmVzdWx0', 'c2hvd01vZGFsRGlhbG9n', 'Y3lqZw==',
           'ZGlhbG9nVG9wOjEwcHg7ZGlhbG9nV2lkdGg6MTEwMHB4O2RpYWxvZ0hlaWdodDo3MDBweDs=', 'MDAy',
           '6LaF6L+H6K+l5byg5Y+R56Wo5b2T5pel5p+l6aqM5qyh5pWwKOivt+S6juasoeaXpeWGjeasoeafpemqjCkh', 'MDAz',
           '5Y+R56Wo5p+l6aqM6K+35rGC5aSq6aKR57mB77yM6K+356iN5ZCO5YaN6K+V77yB', 'MDA0',
           '6LaF6L+H5pyN5Yqh5Zmo5pyA5aSn6K+35rGC5pWw77yM6K+356iN5ZCO6K6/6ZeuIQ==', 'MDA1', '6K+35rGC5LiN5ZCI5rOVIQ==',
           'MDIw',
           '55Sx5LqO5p+l6aqM6KGM5Li65byC5bi477yM5raJ5auM6L+d6KeE77yM5b2T5YmN5peg5rOV5L2/55So5p+l6aqM5pyN5Yqh77yB',
           'MDA2', '5LiN5LiA6Ie0', 'amdieXplZGdlLmh0bWw=', 'amdieXouaHRtbA==',
           'ZGlhbG9nV2lkdGg6ODAwcHg7ZGlhbG9nSGVpZ2h0OjQwMHB4O2NlbnRlcjp5ZXM7c2Nyb2xsOm5v', 'MDA3',
           '6aqM6K+B56CB5aSx5pWIIQ==', 'MDA4', '6aqM6K+B56CB6ZSZ6K+vIQ==', 'MDA5'];


def get_90a1cjs():
    """
    获取eab23js文件
    """
    # 读文件
    # 1.获取当前文件 读文件操作.py 的路径
    abs = os.path.abspath(__file__)
    # 找到上级目录 dirname
    path = os.path.dirname(abs)
    base_dir = os.path.dirname(os.path.abspath(__file__))
    # 路径拼接 ()可以跟多了路径
    file_path = os.path.join(base_dir, "90a1c.html")
    # 2.判断文件是否存在
    if not os.path.exists(file_path):
        print("文件夹不存在就创建")
    # os.makedirs(file_path)
    else:
        # 字节读取
        file_object = open(file_path, mode='rb')
        data = file_object.read()
        file_object.close()
        text = data.decode('utf-8')
        # 文本读取
        file_text = open(file_path, mode='rt', encoding='utf-8')
        file_message = file_text.read()
        file_text.close()
    return file_message

if __name__ == "__main__":
    my_jiemishuzu_dict = {}
    jiemishuzu = arrayjm.jm_array(_0x4633,int(str('0x86'),16)-len(_0x4633))


    for item in range(len(jiemishuzu)):
        my_jiemishuzu_dict[f"""_0x3ff2('{hex(item)}')"""] = jiemishuzu[item]
    # print(my_jiemishuzu_dict)
    js_message = get_90a1cjs()
    pattern = '_0x3ff2\(\'0x.*?\'\)'

    list_t = re.findall(pattern, js_message)

    newstr = js_message
    for key, value in my_jiemishuzu_dict.items():
        newstr = newstr.replace(f"""{key}""", f"'{value}'")
    print(newstr)
